﻿using System;
using System.Windows;
using System.Windows.Data;

namespace WebCrawler.Common
{
    public class BooleanToVisibility : IValueConverter
    {
        #region IValueConverter Members
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return false;

            if (value is bool || value is string)
            {
                return (bool)value ? Visibility.Visible : Visibility.Collapsed;
            }

            return false;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }
        #endregion
    }
}